{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.5.0+27.g2d457b0.dirty\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "import folium\n",
    "\n",
    "print(folium.__version__)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVMgPSBmYWxzZTsgTF9OT19UT1VDSCA9IGZhbHNlOyBMX0RJU0FCTEVfM0QgPSBmYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21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xzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgICAgICAgICA8c3R5bGU+ICNtYXBfNWFmZWEyOTQzZTkyNDFkZjgwNzdiMDBkYzg5MDgyMzAgewogICAgICAgICAgICAgICAgcG9zaXRpb24gOiByZWxhdGl2ZTsKICAgICAgICAgICAgICAgIHdpZHRoIDogMTAwLjAlOwogICAgICAgICAgICAgICAgaGVpZ2h0OiAxMDAuMCU7CiAgICAgICAgICAgICAgICBsZWZ0OiAwLjAlOwogICAgICAgICAgICAgICAgdG9wOiAwLjAlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICA8L3N0eWxlPgogICAgICAgIAo8L2hlYWQ+Cjxib2R5PiAgICAKICAgIAogICAgICAgICAgICA8ZGl2IGNsYXNzPSJmb2xpdW0tbWFwIiBpZD0ibWFwXzVhZmVhMjk0M2U5MjQxZGY4MDc3YjAwZGM4OTA4MjMwIiA+PC9kaXY+CiAgICAgICAgCjwvYm9keT4KPHNjcmlwdD4gICAgCiAgICAKCiAgICAgICAgICAgIAogICAgICAgICAgICAgICAgdmFyIGJvdW5kcyA9IG51bGw7CiAgICAgICAgICAgIAoKICAgICAgICAgICAgdmFyIG1hcF81YWZlYTI5NDNlOTI0MWRmODA3N2IwMGRjODkwODIzMCA9IEwubWFwKAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ21hcF81YWZlYTI5NDNlOTI0MWRmODA3N2IwMGRjODkwODIzMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Y2VudGVyOiBbNDUuMzcyLC0xMjEuNjk3Ml0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB6b29tOiAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heEJvdW5kczogYm91bmRzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGF5ZXJzOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdvcmxkQ29weUp1bXA6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3JzOiBMLkNSUy5FUFNHMzg1NwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgCiAgICAgICAgCiAgICAKICAgICAgICAgICAgdmFyIHRpbGVfbGF5ZXJfODkwMmE5MTYxMWMyNDAxMGJiNTkxZGZlZjU5MTZjOGMgPSBMLnRpbGVMYXllcigKICAgICAgICAgICAgICAgICdodHRwczovL3N0YW1lbi10aWxlcy17c30uYS5zc2wuZmFzdGx5Lm5ldC90ZXJyYWluL3t6fS97eH0ve3l9LmpwZycsCiAgICAgICAgICAgICAgICB7CiAgImF0dHJpYnV0aW9uIjogbnVsbCwKICAiZGV0ZWN0UmV0aW5hIjogZmFsc2UsCiAgIm1heFpvb20iOiAxOCwKICAibWluWm9vbSI6IDEsCiAgIm5vV3JhcCI6IGZhbHNlLAogICJzdWJkb21haW5zIjogImFiYyIKfQogICAgICAgICAgICAgICAgKS5hZGRUbyhtYXBfNWFmZWEyOTQzZTkyNDFkZjgwNzdiMDBkYzg5MDgyMzApOwogICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyX2MxNmE4ZTdkODk0OTQ3YjRiY2JjMTg3ZmY3MTkwZmYwID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNDUuMzI4OCwgLTEyMS42NjI1XSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcF81YWZlYTI5NDNlOTI0MWRmODA3N2IwMGRjODkwODIzMCk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICAgICAgdmFyIGN1c3RvbV9pY29uXzkwODcwYTNmZWQwYjQ1Njg4N2E3YThlNDJjYjllNWJiID0gTC5pY29uKHsKICAgICAgICAgICAgICAgICAgICBpY29uVXJsOiAnaHR0cDovL2xlYWZsZXRqcy5jb20vZXhhbXBsZXMvY3VzdG9tLWljb25zL2xlYWYtcmVkLnBuZycsCiAgICAgICAgICAgICAgICAgICAgaWNvblNpemU6IFszOCw5NV0sCiAgICAgICAgICAgICAgICAgICAgaWNvbkFuY2hvcjogWzIyLDk0XSwKCiAgICAgICAgICAgICAgICAgICAgc2hhZG93VXJsOiAnaHR0cDovL2xlYWZsZXRqcy5jb20vZXhhbXBsZXMvY3VzdG9tLWljb25zL2xlYWYtc2hhZG93LnBuZycsCiAgICAgICAgICAgICAgICAgICAgc2hhZG93U2l6ZTogWzUwLDY0XSwKICAgICAgICAgICAgICAgICAgICBzaGFkb3dBbmNob3I6IFs0LDYyXSwKCiAgICAgICAgICAgICAgICAgICAgcG9wdXBBbmNob3I6IFstMywtNzZdLAogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgbWFya2VyX2MxNmE4ZTdkODk0OTQ3YjRiY2JjMTg3ZmY3MTkwZmYwLnNldEljb24oY3VzdG9tX2ljb25fOTA4NzBhM2ZlZDBiNDU2ODg3YTdhOGU0MmNiOWU1YmIpOwogICAgICAgICAgICAKICAgIAogICAgICAgICAgICB2YXIgcG9wdXBfM2M0ZWNhODQ1YmZkNDg1NTliMGFkZGI3NWUyMzdmNGUgPSBMLnBvcHVwKHttYXhXaWR0aDogJzMwMCd9KTsKCiAgICAgICAgICAgIAogICAgICAgICAgICAgICAgdmFyIGh0bWxfNjUyNGM5OTg3ZjQyNGRkNWIyOWNmNGIwMWYyMzRkN2IgPSAkKCc8ZGl2IGlkPSJodG1sXzY1MjRjOTk4N2Y0MjRkZDViMjljZjRiMDFmMjM0ZDdiIiBzdHlsZT0id2lkdGg6IDEwMC4wJTsgaGVpZ2h0OiAxMDAuMCU7Ij5NdC4gSG9vZCBNZWFkb3dzPC9kaXY+JylbMF07CiAgICAgICAgICAgICAgICBwb3B1cF8zYzRlY2E4NDViZmQ0ODU1OWIwYWRkYjc1ZTIzN2Y0ZS5zZXRDb250ZW50KGh0bWxfNjUyNGM5OTg3ZjQyNGRkNWIyOWNmNGIwMWYyMzRkN2IpOwogICAgICAgICAgICAKCiAgICAgICAgICAgIG1hcmtlcl9jMTZhOGU3ZDg5NDk0N2I0YmNiYzE4N2ZmNzE5MGZmMC5iaW5kUG9wdXAocG9wdXBfM2M0ZWNhODQ1YmZkNDg1NTliMGFkZGI3NWUyMzdmNGUpOwoKICAgICAgICAgICAgCiAgICAgICAgCjwvc2NyaXB0Pg==\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
      ],
      "text/plain": [
       "<folium.folium.Map at 0x7f7030c84400>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from folium.features import CustomIcon\n",
    "\n",
    "m = folium.Map(location=[45.372, -121.6972], zoom_start=12, tiles='Stamen Terrain')\n",
    "\n",
    "url = 'http://leafletjs.com/examples/custom-icons/{}'.format\n",
    "icon_image = url('leaf-red.png')\n",
    "shadow_image = url('leaf-shadow.png')\n",
    "\n",
    "icon = CustomIcon(\n",
    "    icon_image,\n",
    "    icon_size=(38, 95),\n",
    "    icon_anchor=(22, 94),\n",
    "    shadow_image=shadow_image,\n",
    "    shadow_size=(50, 64),\n",
    "    shadow_anchor=(4, 62),\n",
    "    popup_anchor=(-3, -76)\n",
    ")\n",
    "\n",
    "marker = folium.Marker(\n",
    "    location=[45.3288, -121.6625],\n",
    "    icon=icon,\n",
    "    popup='Mt. Hood Meadows'\n",
    ")\n",
    "\n",
    "\n",
    "m.add_child(marker)\n",
    "\n",
    "m.save(os.path.join('results', 'CustomIcon.html'))\n",
    "\n",
    "m"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
